package com.hmall.mapper;

import com.hmall.model.SysUser;
import com.hmall.util.MyMapper;
import com.hmall.vo.UserVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Repository
public interface SysUserMapper extends MyMapper<SysUser> {

    int myInsert(@Param("sysUser") SysUser sysUser) ;

    SysUser simpleUserByUsername(@Param("username") String username);

    SysUser hardUserByUsername(@Param("username") String username);


    int checkUsername(@Param("userName") String userName);

    int checkEmail(@Param("email") String email);

    SysUser selectLogin(@Param("username") String username, @Param("password") String password);

    String selectQuestionByUsername(String username);

    int checkAnswer(@Param("username") String username, @Param("question") String question, @Param("answer") String answer);

    int updatePasswordByUsername(@Param("username") String username, @Param("passwordNew") String passwordNew);

    int checkPassword(@Param(value = "password") String password, @Param("userId") Integer userId);

    int checkEmailByUserId(@Param(value = "email") String email, @Param(value = "userId") Integer userId);

    int selectIdByUsername(@Param(value = "username") String username);


    SysUser selectByUserId(@Param("userId") Integer userId);

    //根据username获取user对象
    SysUser selectByUserName(@Param("username") String username);
    int selectByUserIdToDealerId(@Param("userId") Integer userId);
    int selectByUserIdToRoleId(@Param("userId") Integer userId);
    UserVo selectByRoleIdToUserName(@Param("roleId") Integer roleId);
}